#include "./all.h"
#define PRINTF_BEBUG do{printf("%d",__LINE__);}while(0)
static int IDNUMBER = 1000000; //默认注册为普通用户
static int number = 0;
int main(int argc, const char *argv[])
{
	int sockfd,connfd;
	int ret;
	pthread_t pid;
	sockfd = socket(AF_INET,SOCK_STREAM,0);

	struct sockaddr_in addr,cliaddr;
	addr.sin_family = AF_INET;
	addr.sin_port = htons(7776);
	addr.sin_addr.s_addr = inet_addr("0");
	ret = bind(sockfd,(struct sockaddr *)&addr,sizeof(addr));
	if(ret == -1){
		perror("bind");
		exit(-1);
	}

	listen(sockfd,255);
	while(1){
		printf("已连接客户端%d个\n",number);
		connfd = accept(sockfd,NULL,NULL);
		PRINTF_BEBUG;
		number++;
		pthread_create(&pid,NULL,do_clint,(void*)&connfd);
	}
	return 0;
}
